<?php
class Wall_View_Helper_WallLoop extends Wall_View_Helper_Wall
{
  public function wallLoop($actions = null, array $data = array())
  {
    if( null == $actions || (!is_array($actions) && !($actions instanceof Zend_Db_Table_Rowset_Abstract)) ) {
      return '';
    }
    
    $form = new Wall_Form_Comment();
    
    $viewer = Engine_Api::_()->user()->getViewer();
    $activity_moderate = "";
    if($viewer->getIdentity()){
      $activity_moderate = Engine_Api::_()->getDbtable('permissions', 'authorization')->getAllowed('user', $viewer->level_id, 'activity');
    }

    $data = array_merge($data, array(
      'actions' => $actions,
      'commentForm' => $form,
      'user_limit' => Engine_Api::_()->getApi('settings', 'core')->getSetting('activity_userlength', 20),
      'allow_delete' => Engine_Api::_()->getApi('settings', 'core')->getSetting('activity_userdelete'),
      'activity_moderate' =>$activity_moderate,
      'wall_settings'   =>  Engine_Api::_()->getApi('settings', 'core')->wall
    ));
    
    return $this->view->partial(
      '_wallText.tpl',
      'wall',
      $data
    );
  }
}